<!DOCTYPE html><html><head>
<title>grammar::me::cpu::core - Grammar operations and usage</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.doctools_title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.doctools_section, LI.doctools_subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.doctools_example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.doctools_requirements LI, UL.doctools_syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.doctools_synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.doctools_syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.doctools_requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<!-- Generated from file 'me_cpucore.man' by tcllib/doctools with format 'html'
   -->
<!-- Copyright &amp;copy; 2005-2006 Andreas Kupries &amp;lt;andreas_kupries@users.sourceforge.net&amp;gt;
   -->
<!-- grammar::me::cpu::core.n
   -->
<body><hr> [
   <a href="../../../../../../../../home">Tcllib Home</a>
&#124; <a href="../../../../toc.html">Main Table Of Contents</a>
&#124; <a href="../../../toc.html">Table Of Contents</a>
&#124; <a href="../../../../index.html">Keyword Index</a>
&#124; <a href="../../../../toc0.html">Categories</a>
&#124; <a href="../../../../toc1.html">Modules</a>
&#124; <a href="../../../../toc2.html">Applications</a>
 ] <hr>
<div class="doctools">
<h1 class="doctools_title">grammar::me::cpu::core(n) 0.2 tcllib &quot;Grammar operations and usage&quot;</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>grammar::me::cpu::core - ME virtual machine state manipulation</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
<li class="doctools_section"><a href="#section1">Description</a></li>
<li class="doctools_section"><a href="#section2">API</a>
<ul>
<li class="doctools_subsection"><a href="#subsection1">MATCH PROGRAM REPRESENTATION</a></li>
</ul>
</li>
<li class="doctools_section"><a href="#section3">CPU STATE</a></li>
<li class="doctools_section"><a href="#section4">Bugs, Ideas, Feedback</a></li>
<li class="doctools_section"><a href="#keywords">Keywords</a></li>
<li class="doctools_section"><a href="#category">Category</a></li>
<li class="doctools_section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.4</b></li>
<li>package require <b class="pkgname">grammar::me::cpu::core <span class="opt">?0.2?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">disasm</b> <i class="arg">asm</i></a></li>
<li><a href="#2"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">asm</b> <i class="arg">asm</i></a></li>
<li><a href="#3"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">new</b> <i class="arg">asm</i></a></li>
<li><a href="#4"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">lc</b> <i class="arg">state</i> <i class="arg">location</i></a></li>
<li><a href="#5"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">tok</b> <i class="arg">state</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></li>
<li><a href="#6"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">pc</b> <i class="arg">state</i></a></li>
<li><a href="#7"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">iseof</b> <i class="arg">state</i></a></li>
<li><a href="#8"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">at</b> <i class="arg">state</i></a></li>
<li><a href="#9"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">cc</b> <i class="arg">state</i></a></li>
<li><a href="#10"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">sv</b> <i class="arg">state</i></a></li>
<li><a href="#11"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">ok</b> <i class="arg">state</i></a></li>
<li><a href="#12"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">error</b> <i class="arg">state</i></a></li>
<li><a href="#13"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">lstk</b> <i class="arg">state</i></a></li>
<li><a href="#14"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">astk</b> <i class="arg">state</i></a></li>
<li><a href="#15"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">mstk</b> <i class="arg">state</i></a></li>
<li><a href="#16"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">estk</b> <i class="arg">state</i></a></li>
<li><a href="#17"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">rstk</b> <i class="arg">state</i></a></li>
<li><a href="#18"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">nc</b> <i class="arg">state</i></a></li>
<li><a href="#19"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">ast</b> <i class="arg">state</i></a></li>
<li><a href="#20"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">halted</b> <i class="arg">state</i></a></li>
<li><a href="#21"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">code</b> <i class="arg">state</i></a></li>
<li><a href="#22"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">eof</b> <i class="arg">statevar</i></a></li>
<li><a href="#23"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">put</b> <i class="arg">statevar</i> <i class="arg">tok</i> <i class="arg">lex</i> <i class="arg">line</i> <i class="arg">col</i></a></li>
<li><a href="#24"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">run</b> <i class="arg">statevar</i> <span class="opt">?<i class="arg">n</i>?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2>
<p>This package provides an implementation of the ME virtual machine.
Please go and read the document <b class="syscmd"><a href="me_intro.html">grammar::me_intro</a></b> first if
you do not know what a ME virtual machine is.</p>
<p>This implementation represents each ME virtual machine as a Tcl value
and provides commands to manipulate and query such values to show the
effects of executing instructions, adding tokens, retrieving state,
etc.</p>
<p>The values fully follow the paradigm of Tcl that every value is a
string and while also allowing C implementations for a proper
Tcl_ObjType to keep all the important data in native data structures.
Because of the latter it is recommended to access the state values
<em>only</em> through the commands of this package to ensure that
internal representation is not shimmered away.</p>
<p>The actual structure used by all state values is described in section
<span class="sectref"><a href="#section3">CPU STATE</a></span>.</p>
</div>
<div id="section2" class="doctools_section"><h2><a name="section2">API</a></h2>
<p>The package directly provides only a single command, and all the
functionality is made available through its methods.</p>
<dl class="doctools_definitions">
<dt><a name="1"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">disasm</b> <i class="arg">asm</i></a></dt>
<dd><p>This method returns a list containing a disassembly of the match
instructions in <i class="arg">asm</i>. The format of <i class="arg">asm</i> is specified in the
section <span class="sectref"><a href="#subsection1">MATCH PROGRAM REPRESENTATION</a></span>.</p>
<p>Each element of the result contains instruction label, instruction
name, and the instruction arguments, in this order. The label can be
the empty string. Jump destinations are shown as labels, strings and
tokens unencoded. Token names are prefixed with their numeric id, if,
and only if a tokmap is defined. The two components are separated by a
colon.</p></dd>
<dt><a name="2"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">asm</b> <i class="arg">asm</i></a></dt>
<dd><p>This method returns code in the format as specified in section
<span class="sectref"><a href="#subsection1">MATCH PROGRAM REPRESENTATION</a></span> generated from ME assembly
code <i class="arg">asm</i>, which is in the format as returned by the method
<b class="method">disasm</b>.</p></dd>
<dt><a name="3"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">new</b> <i class="arg">asm</i></a></dt>
<dd><p>This method creates state value for a ME virtual machine in its
initial state and returns it as its result.</p>
<p>The argument <i class="arg">matchcode</i> contains a Tcl representation of the
match instructions the machine has to execute while parsing the input
stream. Its format is specified in the section
<span class="sectref"><a href="#subsection1">MATCH PROGRAM REPRESENTATION</a></span>.</p>
<p>The <i class="arg">tokmap</i> argument taken by the implementation provided by the
package <b class="package"><a href="me_tcl.html">grammar::me::tcl</a></b> is here hidden inside of the match
instructions and therefore not needed.</p></dd>
<dt><a name="4"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">lc</b> <i class="arg">state</i> <i class="arg">location</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and uses it
to convert a location in the input stream (as offset) into a line
number and column index. The result of the method is a 2-element list
containing the two pieces in the order mentioned in the previous
sentence.</p>
<p><em>Note</em> that the method cannot convert locations which the machine
has not yet read from the input stream. In other words, if the machine
has read 7 characters so far it is possible to convert the offsets
<b class="const">0</b> to <b class="const">6</b>, but nothing beyond that. This also shows that
it is not possible to convert offsets which refer to locations before
the beginning of the stream.</p>
<p>This utility allows higher levels to convert the location offsets
found in the error status and the AST into more human readable data.</p></dd>
<dt><a name="5"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">tok</b> <i class="arg">state</i> <span class="opt">?<i class="arg">from</i> <span class="opt">?<i class="arg">to</i>?</span>?</span></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
a Tcl list containing the part of the input stream between the
locations <i class="arg">from</i> and <i class="arg">to</i> (both inclusive). If <i class="arg">to</i> is not
specified it will default to the value of <i class="arg">from</i>. If <i class="arg">from</i> is
not specified either the whole input stream is returned.</p>
<p>This method places the same restrictions on its location arguments as
the method <b class="method">lc</b>.</p></dd>
<dt><a name="6"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">pc</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current value of the stored program counter.</p></dd>
<dt><a name="7"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">iseof</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current value of the stored eof flag.</p></dd>
<dt><a name="8"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">at</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current location in the input stream.</p></dd>
<dt><a name="9"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">cc</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current token.</p></dd>
<dt><a name="10"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">sv</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current semantic value stored in it.
This is an abstract syntax tree as specified in the document
<b class="syscmd"><a href="me_ast.html">grammar::me_ast</a></b>, section <b class="sectref">AST VALUES</b>.</p></dd>
<dt><a name="11"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">ok</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the match status stored in it.</p></dd>
<dt><a name="12"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">error</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current error status stored in it.</p></dd>
<dt><a name="13"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">lstk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the location stack.</p></dd>
<dt><a name="14"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">astk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the AST stack.</p></dd>
<dt><a name="15"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">mstk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the AST marker stack.</p></dd>
<dt><a name="16"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">estk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the error stack.</p></dd>
<dt><a name="17"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">rstk</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the subroutine return stack.</p></dd>
<dt><a name="18"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">nc</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the nonterminal match cache as a dictionary.</p></dd>
<dt><a name="19"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">ast</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the abstract syntax tree currently at the top of the AST stack stored
in it.
This is an abstract syntax tree as specified in the document
<b class="syscmd"><a href="me_ast.html">grammar::me_ast</a></b>, section <b class="sectref">AST VALUES</b>.</p></dd>
<dt><a name="20"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">halted</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the current halt status stored in it, i.e. if the machine has stopped
or not.</p></dd>
<dt><a name="21"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">code</b> <i class="arg">state</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine and returns
the code stored in it, i.e. the instructions executed by the machine.</p></dd>
<dt><a name="22"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">eof</b> <i class="arg">statevar</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine as stored in
the variable named by <i class="arg">statevar</i> and modifies it so that the eof
flag inside is set. This signals to the machine that whatever token
are in the input queue are the last to be processed. There will be no
more.</p></dd>
<dt><a name="23"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">put</b> <i class="arg">statevar</i> <i class="arg">tok</i> <i class="arg">lex</i> <i class="arg">line</i> <i class="arg">col</i></a></dt>
<dd><p>This method takes the state value of a ME virtual machine as stored in
the variable named by <i class="arg">statevar</i> and modifies it so that the token
<i class="arg">tok</i> is added to the end of the input queue, with associated
lexeme data <i class="arg">lex</i> and <i class="arg">line</i>/<i class="arg">col</i>umn information.</p>
<p>The operation will fail with an error if the eof flag of the machine
has been set through the method <b class="method">eof</b>.</p></dd>
<dt><a name="24"><b class="cmd">::grammar::me::cpu::core</b> <b class="method">run</b> <i class="arg">statevar</i> <span class="opt">?<i class="arg">n</i>?</span></a></dt>
<dd><p>This method takes the state value of a ME virtual machine as stored in
the variable named by <i class="arg">statevar</i>, executes a number of
instructions and stores the state resulting from their modifications
back into the variable.</p>
<p>The execution loop will run until either</p>
<ul class="doctools_itemized">
<li><p><i class="arg">n</i> instructions have been executed, or</p></li>
<li><p>a halt instruction was executed, or</p></li>
<li><p>the input queue is empty and the code is asking for more tokens to
process.</p></li>
</ul>
<p>If no limit <i class="arg">n</i> was set only the last two conditions are checked
for.</p></dd>
</dl>
<div id="subsection1" class="doctools_subsection"><h3><a name="subsection1">MATCH PROGRAM REPRESENTATION</a></h3>
<p>A match program is represented by nested Tcl list. The first element,
<i class="term">asm</i>, is a list of integer numbers, the instructions to execute,
and their arguments. The second element, <i class="term"><a href="../../../../index.html#pool">pool</a></i>, is a list of
strings, referenced by the instructions, for error messages, token
names, etc. The third element, <i class="term">tokmap</i>, provides ordering
information for the tokens, mapping their names to their numerical
rank. This element can be empty, forcing lexicographic comparison when
matching ranges.</p>
<p>All ME instructions are encoded as integer numbers, with the mapping
given below. A number of the instructions, those which handle error
messages, have been given an additional argument to supply that
message explicitly instead of having it constructed from token names,
etc. This allows the machine state to store only the message ids
instead of the full strings.</p>
<p>Jump destination arguments are absolute indices into the <i class="term">asm</i>
element, refering to the instruction to jump to. Any string arguments
are absolute indices into the <i class="term"><a href="../../../../index.html#pool">pool</a></i> element. Tokens, characters,
messages, and token (actually character) classes to match are coded as
references into the <i class="term"><a href="../../../../index.html#pool">pool</a></i> as well.</p>
<ol class="doctools_enumerated">
<li><p>&quot;<b class="cmd">ict_advance</b> <i class="arg">message</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">ict_match_token</b> <i class="arg">tok</i> <i class="arg">message</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">ict_match_tokrange</b> <i class="arg">tokbegin</i> <i class="arg">tokend</i> <i class="arg">message</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">ict_match_tokclass</b> <i class="arg">code</i> <i class="arg">message</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">inc_restore</b> <i class="arg">branchlabel</i> <i class="arg">nt</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">inc_save</b> <i class="arg">nt</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_ntcall</b> <i class="arg">branchlabel</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_ntreturn</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">iok_ok</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">iok_fail</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">iok_negate</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_jalways</b> <i class="arg">branchlabel</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_jok</b> <i class="arg">branchlabel</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_jfail</b> <i class="arg">branchlabel</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">icf_halt</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">icl_push</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">icl_rewind</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">icl_pop</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ier_push</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ier_clear</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ier_nonterminal</b> <i class="arg">message</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">ier_merge</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">isv_clear</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">isv_terminal</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">isv_nonterminal_leaf</b> <i class="arg">nt</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">isv_nonterminal_range</b> <i class="arg">nt</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">isv_nonterminal_reduce</b> <i class="arg">nt</i>&quot;</p></li>
<li><p>&quot;<b class="cmd">ias_push</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ias_mark</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ias_mrewind</b>&quot;</p></li>
<li><p>&quot;<b class="cmd">ias_mpop</b>&quot;</p></li>
</ol>
</div>
</div>
<div id="section3" class="doctools_section"><h2><a name="section3">CPU STATE</a></h2>
<p>A state value is a list containing the following elements, in the order listed below:</p>
<ol class="doctools_enumerated">
<li><p><i class="term">code</i>: Match instructions, see <span class="sectref"><a href="#subsection1">MATCH PROGRAM REPRESENTATION</a></span>.</p></li>
<li><p><i class="term">pc</i>:   Program counter, <i class="term">int</i>.</p></li>
<li><p><i class="term">halt</i>: Halt flag, <i class="term">boolean</i>.</p></li>
<li><p><i class="term">eof</i>:  Eof flag, <i class="term">boolean</i></p></li>
<li><p><i class="term">tc</i>:   Terminal cache, and input queue. Structure see below.</p></li>
<li><p><i class="term">cl</i>:   Current location, <i class="term">int</i>.</p></li>
<li><p><i class="term">ct</i>:   Current token, <i class="term"><a href="../../../../index.html#string">string</a></i>.</p></li>
<li><p><i class="term">ok</i>:   Match status, <i class="term">boolean</i>.</p></li>
<li><p><i class="term">sv</i>:   Semantic value, <i class="term"><a href="../../../../index.html#list">list</a></i>.</p></li>
<li><p><i class="term">er</i>:   Error status, <i class="term"><a href="../../../../index.html#list">list</a></i>.</p></li>
<li><p><i class="term">ls</i>:   Location stack, <i class="term"><a href="../../../../index.html#list">list</a></i>.</p></li>
<li><p><i class="term">as</i>:   AST stack, <i class="term"><a href="../../../../index.html#list">list</a></i>.</p></li>
<li><p><i class="term">ms</i>:   AST marker stack, <i class="term"><a href="../../../../index.html#list">list</a></i>.</p></li>
<li><p><i class="term">es</i>:   Error stack, <i class="term"><a href="../../../../index.html#list">list</a></i>.</p></li>
<li><p><i class="term">rs</i>:   Return stack, <i class="term"><a href="../../../../index.html#list">list</a></i>.</p></li>
<li><p><i class="term">nc</i>:   Nonterminal cache, <i class="term">dictionary</i>.</p></li>
</ol>
<p><i class="term">tc</i>, the input queue of tokens waiting for processing and the
terminal cache containing the tokens already processing are one
unified data structure simply holding all tokens and their
information, with the current location separating that which has been
processed from that which is waiting.
Each element of the queue/cache is a list containing the token, its
lexeme information, line number, and column index, in this order.</p>
<p>All stacks have their top element aat the end, i.e. pushing an item is
equivalent to appending to the list representing the stack, and
popping it removes the last element.</p>
<p><i class="term">er</i>, the error status is either empty or a list of two elements,
a location in the input, and a list of messages, encoded as references
into the <i class="term"><a href="../../../../index.html#pool">pool</a></i> element of the <i class="term">code</i>.</p>
<p><i class="term">nc</i>, the nonterminal cache is keyed by nonterminal name and
location, each value a four-element list containing current location,
match status, semantic value, and error status, in this order.</p>
</div>
<div id="section4" class="doctools_section"><h2><a name="section4">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>grammar_me</em> of the
<a href="http://core.tcl.tk/tcllib/reportlist">Tcllib Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
<p>When proposing code changes, please provide <em>unified diffs</em>,
i.e the output of <b class="const">diff -u</b>.</p>
<p>Note further that <em>attachments</em> are strongly preferred over
inlined patches. Attachments can be made by going to the <b class="const">Edit</b>
form of the ticket immediately after its creation, and then using the
left-most button in the secondary navigation bar.</p>
</div>
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#grammar">grammar</a>, <a href="../../../../index.html#parsing">parsing</a>, <a href="../../../../index.html#virtual_machine">virtual machine</a></p>
</div>
<div id="category" class="doctools_section"><h2><a name="category">Category</a></h2>
<p>Grammars and finite automata</p>
</div>
<div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2005-2006 Andreas Kupries &lt;andreas_kupries@users.sourceforge.net&gt;</p>
</div>
</div></body></html>
